﻿using S7Project_One.Base;
using S7Project_One.Table;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace S7Project_One.Server
{
    public class LoginServer
    {
        public static bool CheckUserInfo(string name, string password)
        {
            if (name == "" || password == "")
            {
                return false;
            }
            Debug.WriteLine($"用户名：{name} 密码：{password}");
            //模拟数据库验证
            UserTable u = FreeBase.SQL.Queryable<UserTable>()
                .Where(u => u.UserName == name && u.Password == AesCrypto.Encrypt(password))
                .First();
            if (u == null)
            {
                return false;
            }
                return true;
        }
    }
}
